package com.hanamaki.struct;

import java.util.Scanner;

public class ForDemo01 {
    public static void main(String[] args) {

        //回顾问题1：令狐冲说一百遍“我最棒”
        for (int i = 1; i <= 100; i++) {
            System.out.println("你们最棒" + i);
        }
        //回顾问题2：根据人数和成绩，计算平均成绩
        System.out.println("请输入班级人数");
        Scanner scanner = new Scanner(System.in);
        int peo = scanner.nextInt();
        System.out.println("班级一共" + peo + "人");


        int sum1 = 0;
        double score = 0;

        for (int i = 1;i <= peo;i++) {
            System.out.println("请输入第" + i + "个人的成绩");
            score = scanner.nextDouble();
            sum1 += score;
        }

        System.out.println("平均值：" + sum1 / peo);

        scanner.close();

//        for (初始值;循环条件;迭代){
//            循环体;
//        }



        /*  1---100  总和   */
        int sum = 0;
        for (int i = 0; i <= 100; i++) {
            sum += i;
        }
        System.out.println(sum);

        // 死循环
//        for (; ;) {
//
//        }

    }
}
